function output = group_features(input, num_players_r, num_players_b)

x_tiles = 8;
y_tiles = 4;
distance_tiles = 14; % distance varies between 0 and 135; 14*10 = 140
angle_tiles = 8; % 8*45 = 360
num_tilings = 32;

% initial position 
position = 1;

% group features for x coordinate of the ball
offset = num_tilings*(x_tiles+1) - 1;
output = sum(abs(input(position:offset)));
%output = sum(input(position:offset));
position = 1 + offset;

% group features for y coordinate of the ball
offset = offset + num_tilings*(y_tiles+1) - 1;
output = [output, sum(abs(input(position:offset)))];
%output = [output, sum(input(position:offset))];
position = 1 + offset;

% group features for distance and angle of each player relative to the ball
for k = 1:(num_players_r+num_players_b),

    offset = offset + num_tilings*(distance_tiles+1) - 1;
    output = [output, sum(abs(input(position:offset)))];
    %output = [output, sum(input(position:offset))];
    position = 1 + offset;
    
    offset = offset + num_tilings*(angle_tiles+1) - 1;
    output = [output, sum(abs(input(position:offset)))];
    %output = [output, sum(input(position:offset))];
    position = 1 + offset;
    
end

end